package team.kas.anime.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import team.kas.anime.pojo.Result;
import team.kas.anime.pojo.Video;
import team.kas.anime.service.UserInfoService;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/userInfo")
public class UserInfoCtrl {
    @Autowired
    private UserInfoService userInfoService;

    @RequestMapping("/index")
    private String index()
    {
        return "userInfo";
    }
    @RequestMapping("/getAllVideos")
    @ResponseBody
    private Result getAllVideos(Integer page,Integer limit,String userid)
    {
        Result result=userInfoService.getAllVideos(page,limit,userid);
        return result;
    }
    @RequestMapping("/del")
    @ResponseBody
    private Result del(String id)
    {
        Result result=userInfoService.del(id);
        return result;
    }
    @RequestMapping("/delete")
    @ResponseBody
    private Result delete(String[] ids)
    {
        Result result=userInfoService.delete(ids);
        return result;
    }
    @RequestMapping("/upVideo")
    @ResponseBody
    private Result up(MultipartFile file, HttpServletRequest request)
    {
        Result result=userInfoService.upVideo(file,request);
        return result;
    }
    @RequestMapping("/upImg")
    @ResponseBody
    private Result upImg(MultipartFile file, HttpServletRequest request)
    {
        Result result=userInfoService.upImg(file,request);
        return result;
    }
    @RequestMapping("/add")
    @ResponseBody
    private Result add(Video video, HttpServletRequest request,String uId)
    {
        Result result=userInfoService.add(video,request,uId);
        return result;
    }
    @RequestMapping("/getAllColl")
    @ResponseBody
    private Result getAllColl(Integer page,Integer limit,String uid)
    {
        Result result=userInfoService.getAllColl(page,limit,uid);
        return result;
    }
    @RequestMapping("/delColl")
    @ResponseBody
    private Result delColl(String id)
    {
        Result result=userInfoService.delColl(id);
        return result;
    }
    @RequestMapping("/getAllFan")
    @ResponseBody
    private Result getAllFan(Integer page,Integer limit,String fanid)
    {
        Result result=userInfoService.getAllFan(page,limit,fanid);
        return result;
    }
    @RequestMapping("/delFan")
    @ResponseBody
    private Result delFan(String id)
    {
        Result result=userInfoService.delFan(id);
        return result;
    }
    @RequestMapping("/userVideo")
    private String userVideo()
    {
        return "userVideo";
    }
    @RequestMapping("/userColl")
    private String userColl()
    {
        return "userColl";
    }
    @RequestMapping("/userFan")
    private String userFan()
    {
        return "userFan";
    }
    @RequestMapping("/userAddVideo")
    private String userAddVideo()
    {
        return "userAddVideo";
    }
    @RequestMapping("/main")
    private String main()
    {
        return "main";
    }
}
